<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">
    <link rel="stylesheet" href="css/manageStyle.css">
    <script type="text/javascript" src="js/jquery-1.11.1.min.js" ></script>
    <script type="text/javascript" src="js/bootstrap.min.js" ></script>
</head>

<body>
<div id="wrapper">
    <div class="overlay"></div>
    <!-- Sidebar -->
    <nav class="navbar navbar-inverse navbar-fixed-top" id="sidebar-wrapper" role="navigation">
        <ul class="nav sidebar-nav">
        </ul>
    </nav>
    <div id="page-content-wrapper">
        <button type="button" class="hamburger is-closed animated fadeInLeft" data-toggle="offcanvas">
            <span class="hamb-top"></span>
            <span class="hamb-middle"></span>
            <span class="hamb-bottom"></span>
        </button>
        <div class="container">
            <div id="resource-upload">
                <form>
                    <div class="form-group">
                        <label for="exampleInputEmail1">补充所上传资料的相关信息：</label>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">资料编号</label>
                        <input type="text" class="form-control" id="data_Num" placeholder="Material number">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">资料标题</label>
                        <input type="text" class="form-control" id="data_Title" placeholder="Material Title">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">资料形式</label>
                        <input type="text" class="form-control" id="data_form" placeholder="Material Form">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">截止日期</label>
                        <input type="text" class="form-control" id="end_date" placeholder="End of the date">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">所属类别</label>
                        <input type="text" class="form-control" id="category" placeholder="Belongs to the category">
                    </div>
                    <button type="submit" id="referenceBtn" class="btn btn-primary" >上传</button>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        //资料上传
        $("#referenceBtn").click(function () {
            console.log("资料上传！");
            $.get("/updataRef", {
                "dataNum": $("#data_Num").val(),
                "dataTitle": $("#data_Title").val(),
                "dataForm": $("#data_form").val(),
                "endDate": $("#end_date").val(),
                "category": $("#category").val()
            }, function (result) {
                console.log(result);
                if (result == "1") {
                    alert("资料上传成功！");
                    $("#cuowukuang").fadeIn();
                    window.location = "/";
                } else {
                    alert("资料上传失败！");
                    $("#cuowukuang").fadeIn();
                    $("#cuowukuang").html("提交失败");
                    window.location = "/";
                }
            })
        })
    })
</script>
</body>

</html>